package stream;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * @author 杜伟毅
 * @version 1.0
 * @since 2024/09/11
 * Stream流的创建
 */
public class StreamTest {
    @Test
    public void creatTest() {
        ArrayList<String> list = new ArrayList<>();
        //第一种方法，使用集合的方式
        Stream<String> stream = list.stream();
        //map中是没有直接转换成流的。
        HashMap<String, String> map = new HashMap<>();

        int[] array={1,3,5,6,8};
        IntStream streamA = Arrays.stream(array);

        String[] arrayString ={"1","2"};
        Stream<String> stream1 = Arrays.stream(arrayString);

        //将同一类型的合并起来
        Stream<String> concat = Stream.concat(stream, stream1);


    }
}
